Yes, that's true, but forget about the peaks for a moment; what's going on
besides the peaks? If the rest of the audio data is much lower, let's say -18dB, then more bits will be required to describe this data, because there's 17dB of dynamic range there (i know, I'm oversimpifying for this example). If the rest of the audio is also loud, though, let's say -6dB, it will require fewer bits to describe; then the dynamic range is only 5dB. That's why compressing- reducing the difference between the "loudest stuff" and the "quietest stuff"- will cut down on the number of bits necessary to describe it.
I have to say again, though- it has nothing to do with sound quality. I love compression, but I have no idea what a "bit" sounds like.