Compression reduces the height of the signal to a preset level. This level can change over time. Known as 'attack', a greater attack level will give a more aggressive sound.
Another effect of compression is that it expands the length of a held note, or its sustain. The compressor tries to keep the output level approximately the same, even if the input level is decreasing. As a result, the sustain will seem to hold at its original level longer.
Compression has a side effect of raising the background noise of a signal. This can sometimes be circumvented with a properly-configured noise gate patched in before the compressor.
Some famous compressor pedals are the Keeley compressor, The Barber Tone Press, and the MXR Dynacomp...