How do I compare chords played on a guitar with a known sample?
You probably need more than one algorithm for an accurate detection. Work on frequency domain (mostly via DFT and spectrogram) is the most often used initial transform. After that sophisticated probabilistic models originally used in speech recognition are applied, such as hidden Markov models, dynamic Bayesian networks, and conditional random fields.

The review article Automatic Chord Transcription Using Computational Models of Musical Context gives you a thorough overview on the relevant technique, although it focuses on a more complicated chords recognition with more than one instrument (key, bass note, beat are all considered as well). 

There are also some open source chord detection algorithms:
Chordino, Chordata, and
LabROSA Chord Recognition. Note that in LabROSA, a supervised learning method is applied to "teach" the model recognize the chords with higher accuracy. 

This is a very interesting topic, and I look forward to see your update in your guitar chord detection result.