We show that slight variations of a crystal lattice cause significant spectral modifications of phonon-polariton resonant near-field interaction between polar semiconductor crystals and a scanning metal tip. Exploiting the effect for near-field imaging a SiC polytype boundary, we establish infrared mapping of crystal structure and crystal defects at 20 nm spatial resolution (lambda/500). By spectroscopic probing of doped SiC polytypes, we find that phonon-polariton resonant near-field interaction is also sensitive to electronic properties due to plasmon-phonon coupling in the crystals.