Assuming you are referring to game mechanics, then first, you have two spellcasters, A & B.
1)Caster A wants to counterspell, so he readies an action; if caster B casts a spell, then caster A will try to counterspell it.
2)Next, assuming caster B does try to cast a spell, then caster A, having readied a counterspell, then attempts to identify the spell that B is casting. This is just a standard spellcraft check.
3)If B's spell is identified, then caster A has to see if he/she has the same spell prepared (or for sorcerers or bards, have the spell in his/her repertoire and a slot to use it in).
4)If caster A is able to cast that spell, then he/she can use that casting to counter caster B's spell and thereby use up both casters' spell slot for that spell.
Caster A has to be in range for the spell, and it doesn't matter if one or the other spell is metamagicked. It doesn't matter if both casters are different classes, as long as the spell is the same spell. Also, there are certain spells (identified in their descriptions) that counter each other as well. Furthermore, there is a feat in either Tome & Blood or Magic of Faerûn (I don't recall which) that lets you use any spell of the same school as the spell to be countered. This is all just a summary of what the Player's Handbook already says in the Magic section, btw, so if you want more info, check there, or in the SRD.
Edit: I forgot to mention using Dispel Magic. If you use Dispel Magic (or Greater Dispelling) to counterspell, then you can skip the identification part, and you can use the Dispel instead of using the same spell you are counterspelling. The only other difference is that you have to make a dispel check, as using dispel magic does not automatically work. See the description for Dispel Magic.