Can't remember exactly but I think it is acid corrosion of some form in white and when it turns blue it has been neutralised by something. If your worried try putting some bicarbonate of soda( an alkali) on it, should help to neutralise any acidic areas.
Proper answer - its lead sulphate And its not a particularly nice substance. Its not for anything when its on the terminals- but when your battery is working properly it is formed inside when the battery is discharging but then reconverts to lead and sulphuric acid when the battery is recharged http://en.wikipedia.org/wiki/Lead_sulfate