I hate to be "that guy" but do a search. There are a few excellent threads here on the topic.
As said - it REALLY depends on the compressor, but keeping it simple, 3 knobs:
Level, Attack, Sustain
Level is exactly that - how loud when the effect is when on. Since a compressor messes with dynamics, it can make your instrument seam louder/quieter so you especially if you are kicking it on-off you need to set this carefully. Bonus, most can be used as a lead boost if you want!
Attack - This is how soon the effect kicks in to start squashing runaway signal spikes. Fast means right away (check your instruction for the direction on the knob). Set at max, this often takes the peak right off the signal and makes it sound very "effect-y". Listen to the Police, Every Breathe You Take, the arpeggios, for a compressor sound where it is set like this. At the other end, it lets the full attack of the string, and the max signal peak get through. In between somewhere, calms the signal more/less to your taste.
Sustain - this makes the quiet parts louder. As the note trails off, at a certain point it brings the level up. Handy on those long David Gilmour-esque solos if using a single coil Strat and not maxing the gain! Downside here is that it makes other noise louder besides the main signal also.
Many these days like the "blend" control which mixes the dry signal in with the compressed tone. They say it brings back what the comp takes a way. That's most people. Or maybe you got a crappy compressor that really colors the sound. I say it defeats the purpose. Kinda like compressors for people that don't like/need compression.
SO....
Fast attack, max sustain: A heavily compressed, but very even signal that rings for days.
Slow attack, max sustain: All the note attack glory and dynamics are there, but that note will go on and on and on....
Fast Attack, low sustain: Adds bite and definition and even outs all of that sloppy picking, but the notes fade naturally.
I almost always use a compressor on my acoustic, as it is a clean sound, and my tacky picking/strumming results in a lot of "unwanted dynamics" if you know what I mean. The comp really evens things out. I set a moderately fast attack, and a low sustain, because my acoustics hold their notes decently.
Compressors are often used on clean instruments, as a heavily distorted signal actually IS compressed. That distortion "clipping" is essentially saying "Nothing can be louder than 10!" and at there same time "Everything is going to be 10"
The Ratio thing above is a setting for the amount of compression. My recommendation, start simple. There is ratio, hard knee, soft knee and a host of other variables....Lots of good 3 or 4 knob comps out there. Often cheap, because people buy them and don't know how to use them.
Our other guitar play uses one when he plays Lay It Down by Ratt. Really makes the intro riff pop.
A good comp preserves your tone without coloring it. My comment, all but the uber expensive ones do. I like a tone knob on one. Also, it does not add noise. Best advice I have ever read (and it was here): Set it until you know it is on, and then turn it back a little bit just until you can't tell for sure. It's working perfectly then.