An audio compressor keeps the long-term dynamic range of a signal within a set range. It typically works on the milliseconds-to-seconds range, rather on a sample-to-sample range (where it would introduce way too audible distortion).
A typical compressor has the following components:
The function of a compressor is to make the average signal strength follow the following equation:
out_level = in_level < threshold : in_level + makeup_gain in_level >= threshold : threshold + (in_level-threshold) / ratio + makeup_gain
(Some compressors apply make-up gain before the threshold, but the function is equivalent with slightly different numbers.)
The level detector will trigger the envelope, which modulates down the output gain based on how hard it was triggered.
A limiter is much like a compressor, except the compression ratio is infinity-to-one to make sure that the output signal never exceeds the desired threshold level. The affect of frequent limiting is very audible and distracting to a mix, as sounds will fluctuate in relative strength, so limiting should be kept to a minimum. For example, when doing digital recording, aim for a peak level of -6 dB, and set your limiter at -1 dB to avoid digital clipping if the volume goes above your intended peak by too much.
For digital mixing, I believe it's often preferrable to do saturation (and accept the truncation distortion) than to have too hard limiting. Especially if you use a soft-clip function rather than hard saturation, and don't go into clipping too much.