Distilled water is water that has been heated to steam and then condensed. This process leaves behind salts and particulates. However substances that have a lower boiling point than water will also vapourise and be collected along with the distilled water. So the source of the water used is important to limit this problem. Deionised water is made by running water (even distilled water) through an electrically charged resin. Ions in the water exchange with ions in the resin producing water. The process does not remove such things as sugars, bacteria or viruses. The problem with deionised water is that although it has a ph is 7 when produced it is highly reactive and when it comes into contact with carbon dioxide from the air the result is carbonic acid with a ph as low as 5.6. This means that as soon as you open a bottle of deionised water it rapidly becomes acidic (if it isn't already). So distilled water may have impurities which affect the performance of the
battery. Carbonic acid generally does not react with metals so there is no issue with adding deionised water to a
battery. Incidentally it is not advisable to drink either distilled water (because of lack of minerals and impurities although not dangerous) or deionised water (as it is corrosive).