a knitty.com article on checking gauge.
the holes are really there to check your needle size - you slip the needle into the holes, the smallest one it will fit into is the needle's size.
but....i've also read if you have a yarn and no info on what needle size is recommended, you can try slipping the yarn through the holes to see which it "fits" into best and that's the needle size you should start with to check your gauge. never tried this, don't know how accurate it really is!
there's usually also a 2 inch "L" shaped opening on the gauge ruler. you lay that against your swatch and count how many stitches you have horizontally and how many rows there are vertically, then compare that to the gauge required for your project. you change your needle size if you are not knitting the proper gauge. too few stitches and you need to go down a needle size or so to get more stitches. if your swatch measures too many stitches, you'll need to go up a needle size or two. if you change your needle size, you will need to knit another swatch to check the new gauge.