Inside the onion cells there are some chemical compounds which contain sulfur. When you cut an onion its cells are broken and those chemical compounds then undergo a reaction that transforms them into a more volatile sulfured products, which are released into the air. These sulfured compounds react with the moisture in your eyes forming sulfuric acid.
Jackson1250 is correct. Onions contain sulfur which is released in the air when you cut them. Your eye moisture (mostly H2O, water) reacts with the sulfur (S) to create H2SO4 (sulfuric acid). This irritates your eyes.
When you cut the onion it produces some enzymes which contains some chemicals which irritates the eyes. These chemicals are amino acid sulfoxides, form sulfuric acids, they do quickly rearrange themselves into a volatile gas and goes in to the eyes.