It's the casing, believe it or not. You mount the mic element at the end of a tube, and put holes in the sides of the tube, and baffles to increase the length of the acoustic path along the tube. That way, the sounds that come from the front, that miss the front of the mic element but travel alongside the tube, go through the holes in the tube, and back forward to the back of the element, arriving 180 degrees out of phase, reinforcing the signal from the front. Think of a transmission line 1/2 wavelength long. Sounds that come from the sides or the back arrive at the element out of phase, and so cancel out.
It's theoretically possible to do this at home, but if your time has value, it'd be cheaper to buy one. :-)
Hope This Helps! Rich