A gap counts as a mismatch. BLAST may discontinue the alignment when the diversity in a region is too high, so these mismatches are then not accounted for by BLAST. When in doubt, perform a quick multiple alignment to visualize if BLAST has indeed truncated an alignment prematurely. (Note: Multiple alignments work for this purpose because the multiple alignments are created using an algorithm different from BLAST).