YouTube link. (the video is silent)
From Physics Buzz:
A team of three international scientists has explained the physics behind why beer in a bottle transforms into an overflowing mass of foam when the bottle receives a vertical tap on the mouth, as shown in the video. They will present their work and its applications outside of the bottle at the 66th Annual Meeting of the APS Division of Fluid Dynamics.
Abstract: "A sudden vertical impact on the mouth of a beer bottle generates a compression wave that propagates through the glass towards the bottom. When this wave reaches the base of the bottle, it is transmitted to the liquid as an expansion wave that travels to free surface, where it bounces back as a compression wave. This train of expansion-compression waves drives the forced cavitation of existing air pockets, leading to their violent collapse. A cloud of very small daughter bubbles are generated upon these collapses, that expand much faster than their mothers due to their smaller size. These rapidly growing bubble clusters effectively act as buoyancy sources, what leads to the formation of bubble-laden plumes whose void fraction increases quickly by several orders of magnitude, eventually turning most of the liquid into foam."