pH is a scale on which the strength of aciditiy or basicity of a solution is measured. This scale is a measure of the concentration of hydrogen ions (protons) in solution going from pH 0 for acidic solutions to pH 14 for basic solutions. pH is a very important thing to measure and understand for home brewing as it affects the mash and the activity of yeast during the fermentation.
pH a measure of the concentration of protons in an aqueous (water based) solution. pH is measured on a logarithmic range from 0, very acidic (think battery acid) through 7, neutral (pure water) to 14, highly basic (very strong bleach).
pH can be measured using either litmus paper / pH strips where the colour of the strip is then compared to the colour scale provided with the papers or with a pH meter. pH strips are the easiest method as to get an accurate reading from a pH meter it needs to be calibrated using pre-bought standards.
When / how to measure? - It is important to measure the pH of the mash early on as the pH decreases over time. The best time to measure it will be after 5 minutes or when the grains have been fully mixed. Temperature has a large effect on the accuracy of the reading, especially at higher temperatures. Therefore, it is recommended that draw some liquid from the mash and allow it to cool to room temperature (2-5 mins for a low volume) before taking a reading. This also holds true for measuring the pH of the water in the hot liquor tank. I would recommend this approach for both the use of litmus paper and a pH meter.
Chalky (Hard) water is detrimental to brewing process as it can interfere with clarification. Due to the buffering power of the bicarbonate in chalky water it can make it difficult to move the pH to the ideal pH of ~5.3. The first step for the treatment of chalky water is to try and remove as much of the bicarbonate as possible. This is done by boiling the water or neutralising with acid treatment. For the home brewer this is a two part process. The first part is boiling the water for approximately 30 minutes and allowing to cool before use, preferably the day before brewing. A precipitation should be observed and this is the bicarbonate that has come out of solution. By boiling the water we will lower the pH but also remove some of the necessary calcium ions required for the activity of necessary co-enzymes. The second phase is the addition of calcium ions as ether calcium chloride or calcium sulphate to again lower the pH toward 5.3 and add the necessary mineral content for co-enzyme activity.
For soft water this isn't an issue as there are low levels of bicarbonate present so the addition of additional minerals is the only step required. However, this can make the water too acidic so after the mineral addition it is best to check the pH and if required add some calcium carbonate (precipitated chalk) to the grist not the water. This is very much trial and error and when performing this extensive notes should be taken on the amounts of salts added and pH of both the water and mash. This will allow you to get the perfect mash every time in the future.
Yeast thrives in a solution of pH 5.1-5.4 and therefore the closer to this pH the more complete the fermentation will be (conversion of sugar to alcohol). However, if your mash was around pH 5.3 then it is unlikely that you will need to adjust the pH prior to fermentation. If however it is wildly out then this will affect the enzyme activity of the yeast and will result in poor sugar conversion to alcohol. The addition of small amounts of different minerals can help get the wort back into the desired pH range.
This is by no means a definitive guide to pH but, I hope this quick whistle stop tour into the role of pH in brewing has helped give you an idea of why it is important and also how you might monitor it and adjust it to your needs.