In IHC, HRP is conjugated to a secondary antibody that binds to a primary antibody attached to the target antigen. When a substrate such as diaminobenzidine (DAB) is added, HRP catalyzes the oxidation of DAB in the presence of hydrogen peroxide, resulting in a brown precipitate that marks the presence of the antigen. This allows for the microscopic visualization of specific proteins within tissues.