Why is the Dulong–Petit law not applicable to the elements Be, B, C, or Si?
I refer to the same link and add a summary:

The deviation is quantum mechanical in nature. The Dulong–Petit Law is exact only if all vibrational modes are fully activated, in which case equipartition theory can be used. As every atom in a solid can be considered to be a three-dimensional harmonic oscillator, the contribution to the heat capacity is $3k_\mathrm{B}$ for one atom, or $3R$ for one mole.

However, this applies exactly only as the temperature goes to infinity. For finite temperatures we can still come close if the thermal energy is high enough versus the energy required to excite the vibrational modes:

$$k_\mathrm{B}T \gg \hbar\omega$$

For most elements – except the elements listed in the question – room temperature is high enough to come close to full excitation. For the elements in question, the vibrational frequency $\omega$ is large, particularly because of the strong bonds and relatively small masses ($\omega \propto \sqrt{k/m}$.)