Well, this is going to be technical, but also easily understandable. Compression belongs to a category of processing know as dynamics processing. As this name implies, dynamics processing changes the gain, which is the electronic version of volume. Dynamics processors fall into two broad categories: Expanders and Compressors. The names of these effects are completely appropriate. Compressors compress the dynamic range, and Expanders expand the dynamic range.
Compressors have two basic parts, the compressor, and an amplifier. The compressor reduces the level of any signal which is higher than a set level. That level is called the threshold, and is set with the threshold control. The amount by which this signal is reduced is called the ratio. This means exactly what the name suggests: for instance, if the ratio is set at 2:1, than for every 2 dB the input signal rises above the threshold, the output of the compressor will rise 1 dB. Similarly, if the threshold is 4:1, than for every 4 dB the input signal rises, the output signal only rises 1 dB. The attack and release control the speed at which the compressor begins to reduce the level, and the speed at which it stops reducing the level. The second part of the Compressor is the make-up amplifier. This raises the level of the whole signal, so your perceived level remains the same.
Compression IS basic recording technique, and I have only touched on the basics here. Dynamics Processing is one of the most powerful areas of processing, and without a thorough knowledge of dynamics you will not be able to make professional, nor even semi-professional, recordings.
Light
"Cowards can never be moral."
M.K. Gandhi