The anharmonic lattice dynamics of rock-salt thermoelectric compounds SnTe and PbTe are investigated with inelastic neutron scattering (INS) and first-principles calculations. The experiments show that, surprisingly, although SnTe is closer to the ferroelectric instability, phonon spectra in PbTe exhibit a more anharmonic character. This behavior is reproduced in first-principles calculations of the temperature-dependent phonon self-energy. Our simulations reveal how the nesting of phonon dispersions induces prominent features in the self-energy, which account for the measured INS spectra and their temperature dependence. We establish that the phase space for three-phonon scattering processes, combined with the proximity to the lattice instability, is the mechanism determining the complex spectrum of the transverse-optic ferroelectric mode