Weak acids work by partially dissociating in aqueous solutions, releasing protons that interact with the tissue components and the staining dyes. This interaction helps in the binding of dyes to specific tissue elements, thereby enhancing the contrast between different cellular structures. For example, in the Hematoxylin and Eosin (H&E) staining method, acetic acid is used to adjust the pH of the eosin dye, ensuring that it binds effectively to the cytoplasmic components of the cells.