"If the opinion is right, they are deprived of the opportunity of
exchanging error for truth: if wrong, they lose, what is almost as
great a benefit, the clearer perception and livelier impression of
truth, produced by its collision with error."
what can be paraphrased as "something which" or "that which".
... they lose {something which} is almost as great a benefit [as being able to exchange error for truth]
namely...
... they lose ... the clearer perception and livelier impression of truth
You might say that what stands in, like a placeholder, for the actual object of lose, "the clearer perception and livelier impression of truth". This is an oratorical strategy, something like a little drum roll, to create a bit of rhetorical suspense. The actual noun-phrase is delayed.
Compare:
And now I'd like to introduce someone, a person who has been most important for our company's success this year, Joe Average.
And now we'd like to tell you what we have been keeping secret all these years, the planet which these extraterrestrials call home.