Oh yes, i remember asking this question 2 months ago and went to read up a bit from the net and try hands on on some pedals and the "Smart Volume Management" (SVM) feture of my sound card (works about the same as a compressor).
A compressor, generally (not only for guitars, but for recording, even vocals etc) narrows the peak levels of sound waves. ie, as what sub has said, it makes waves with low amplitudes larger and waves with large amplitudes a lil smaller. Depending on your level of compression (if its saturated (very high), soft and loud sounds will sound the same, quite dead in fact with little dynamics).
This also applies to stompboxes compressors, they do the same to ur guitar's (in this case) signal. For guitars, our proplem has always been that the tone, from the time of picking, it will start to get softer unlike a million other instruments (esp woodwind, reed, violins etc) where u can sustain or even make volume swells for added dynamics. THUS, by the idea of how a compressor works, it CAN make a guitar sustain longer (most normal compressors does this, do not be decieved that only "compressor/SUTAINER" does it). When u 1st pick, the guitar's signal is the loudest, then it slowly fades and the amplitude gets lower. Compressors would then try to normalise the signal to make it even, thus ur sound does not seem to fade away as much.
How do you compare compressors then? One thing i haven't found out is the diff between "classic" compressors and the "modern" compressors for guitar stompboxes.
Examples:
Classic:
http://www.jimdunlop.com/index.php?page=products/pip&id=244&pmh=products/p_and_e_detail
Modern:
http://www.jimdunlop.com/index.php?page=products/pip&id=244&pmh=products/p_and_e_detail
Just a rough guide to these 2 cats. I don' know if its feature wise thats different or the way they affect your tone. People generally say that a good compressor is one which is the most transparent (does not affect the original tone much, just the signal level). These kinds of compressors, well they are not usually mass produced like the CS-3 or those MXR examples up there. The most transparent compressors, from all that i've read before, are bootique ones like robert keeley's custom, analogman's ross, goosonique's citrus, and modded ones like randolf's cs-3... Well, all i know is that, these aren't cheap... That's why i'm stuck with my stock CS-3 :lol: