I am no AJ deLange, but I will add a couple things.
You can lower the pH by adding Calcium, as stated.
You can raise pH pH by adding CaCO3, as stated.
Minerals common in homebrewing:
CaSO4 (gypsum) lowers pH, and adds SO4 which adds to the hop perception. Use for hop focused beer like IPA.
CaCl2 (Calcium Chloride) lowers the pH and adds Chloride which enhances malt perception. Use for malt focused beers like Bock.
CaCO3 (Calcium Carbonate, or chalk) raises the pH. Note that adding the carbonate also adds calcium, so you are taking the pH higher, but the Ca addition impeeds how much it goes up.
NaHCO3 (Sodium bicarbonate), or baking soda) will raise the pH, without adding Ca.
MgSO4 (Epsom Salt) do not change the pH of the mash, adds to SO4 total. Mg is beneficial for yeast at 10-20 ppm.
NaCl (Salt) does not change pH. Adds to Cl total.
Some people pay attention to the ratio of SO4 to Cl. >1 for hoppy, <1 for Malty.
Acids can also be used to lower the pH. Lactic acid and Phosphoric acid are the ones most homebrewers use.
If the pH in the mash gets over 5.8, the mash efficiency suffers and falls off quickly with higher pH. I saw this in at graph at a presentaion about mashing.
One last thing, you need to know your base water mineral content before you start to really adjust your water for different styles.