pH is a term used to describe the relative concentrations of hydrogen ions present in a sample of H2O. Acids (<7) are substances that are able to ionize in solutions thereby increasing the concentration of H+ ions. They are proton donors. Bases (>7) will accept H+ ions readily. Thus they are proton acceptors; they increase the concentration of OH- in solutions. Hydroxide ions, OH- are basic because they will react with H+ ions to form H2O. (H+) + (OH-)=H2O. Thus if a solution has more H+ than OH- it is considered acidic. If a solution has more OH- than H+ it is considered basic.
So pH is simply a measure of the relative H+ ions present in H2O. Alkalinity is a relative measure of the amount of "buffers" present in H2O.
Mg stands for Magnesium. pH, Ca, Alk, and Mg are probably the most important measurements you can test for in your tank. When they are all in line, good things will happen for your coral, fish, inverts, and overall health of your tank.