Normal fluids like air and water typically obey what are called wave equations. The particles move around in a way that lets us treat them like one continuous wave (rather than a bunch of discrete particles), with a speed of transmission of these waves being the speed of sound in that material.
A shock wave is what happens when an object moves through such a fluid too fast to permit this nice easy to model behavior. Once you exceed the speed of sound in that medium, we can no longer treat the system as a single continuous pressure field. The handwavey explanation is that the molecules don't have time to push each other out of the way. (the non-handwavey explanation involves looking at the mean path between collisions of molecules at those temperatures versus the speed of the bullet).
Shocks transmit energy differently. If you try to model them as a pressure field, you find that there's a sudden discontinuity where the pressure near a point jumps dramatically. By sudden, I mean it's on the order of single digit nanometers (3nm is a common number, but it varies by material). This behavior is very effective at transmitting energy into the glass, which can result in a nearly instant shattering of the glass.
However, it is unlikely that "shock waves" is actually the correct answer. Without having seen the particular footage you are referring to, most bullets don't travel fast enough to create a shock wave in water. While the speed of sound is around 330m/s in air, it's 1450m/s or faster in water. There are some rounds which can go over 1200m/s (such as the .220 Swift), 1400 and 1500 m/s speeds are more associated with anti-tank penetrator rounds. Thus, while many rounds are "supersonic" in air, as far as I can tell no rifle rounds are supersonic in water.
What you are likely seeing is not a shock wave, but simply a very fast pressure wave. These propagate at the speed of sound in the medium. Because water is an incompressible fluid, it is very easy for the round to set up a high intensity pressure wave in the glass which can shatter the glass similarly to a shock wave. On short distances, such as within the glass, it's hard to tell them apart.
Its common for people to refer to some pressure waves as "shock waves" because they meet the intuitive feel of the word "shock." That is likely what happened in the demo you saw. It's tricky for bullets because many rifle bullets are indeed supersonic in the air, and the crack you hear is indeed a true shock wave. However, once you enter an incompressable fluid like water, with a much higher speed of sound, the mechanics are different.