There are different kinds of DNA binding domains; the ones involved in base identification in the major groove can differentiate between different base pairs of the same nucleotides i.e. AT vs TA because they bind to functional groups on a nucleotide and not the base-pair per se. The stereochemistry i.e. which nucleotide is in the major groove, is important. The location of the nucleotides in the major groove also is a factor (Figure 1).
Figure 1: DNA sequence identification by Helix-Turn-Helix transcription factor. This is the example case of the Engrailed protein in Drosophila. Reproduced from Paro and Sauer (1992) .
You can see that Adenine is recognised differently than Thymine. In many cases such as that of zinc finger proteins (ZF), sequence identification usually happens for dinucleotide pairs such that each finger (a modular unit) can identify a di/tri-nucleotide (Figure 2,3). An array of fingers in case of ZF and helices in case of Helix-Turn-Helix motifs can recognize a unique stretch of DNA sequence (which is certainly more unique than individual base pairs). Usually the binding of the fingers are co-operative which leads to increased affinity and specificity of the protein-DNA binding [2,3]. Analogous mechanism may exist for other kinds of DBD too (I haven't specifically looked for that). Moreover, many DNA motif binding proteins oligomerize, which is again co-operative. This increases the specificity and the overall binding kinetics becomes sigmoidal and thresholded (see Hill kinetics).
Binding mechanisms are best understood for ZF proteins that led to the development of zinc finger nucleases which was one of the first modern methods of targeted genome editing  (though they have now been obsoleted by CRISPR-Cas system).
Figure 2: DNA sequence identification by zinc finger proteins. This example considers the Zif268 protein. Reproduced from Paro and Sauer (1992) .
Figure 3: A more detailed depiction of Zif268-DNA interaction. Reproduced from Durai et al. (2005) .
- Pabo, Carl O., and Robert T. Sauer. "Transcription factors: structural families and principles of DNA recognition." Annual review of biochemistry 61.1 (1992): 1053-1095.
- Krishna, S. Sri, Indraneel Majumdar, and Nick V. Grishin. "Structural classification of zinc fingers SURVEY AND SUMMARY." Nucleic acids research 31.2 (2003): 532-550.
- Lee, Juyong, Jin-Soo Kim, and Chaok Seok. "Cooperativity and Specificity of Cys2His2 Zinc Finger Protein− DNA Interactions: A Molecular Dynamics Simulation Study." The Journal of Physical Chemistry B 114.22 (2010): 7662-7671.
- Durai, Sundar, et al. "Zinc finger nucleases: custom-designed molecular scissors for genome engineering of plant and mammalian cells." Nucleic acids research 33.18 (2005): 5978-5990.