pH (potential of hydrogen) is a scale of acidity from 0 to 14. It tells how acidic or alkaline a substance is. More acidic solutions have lower pH. More alkaline solutions have higher pH. Substances which are not acidic or alkaline (neutral) usually have a pH of 7. Acids have a pH less than 7. Alkalis have a pH greater than 7.
pH indicator solutions are themselves weak acids or bases. As one chemical is added it changes the arrangement of the electrons in the molecule causing it to absorb different wavelengths of light and therefore appear different in colour.
Different chemicals can be used for different pH ranges as shown in the diagram below.