The sound is being generated by a
speaker. The speaker works by
moving a small cone back and forth generating the appropriate frequency.
You can sometimes see the movements.
Many frequencies make the glass vibrate, but only a handful make it vibrate
so much that it cannot stay together. Those frequencies are the resonant
frequencies—they make the glass vibrate (i.e. oscillate) much more
than the other frequencies.
Since the glass is insufficiently
elastic, it shatters.