We demonstrate that DiI and Rhodamine B, which are not easily distinguishable to one-photon measurements, can be differentiated and in fact quantified in mixture via tailored two-photon excitation pulses found by a genetic algorithm (GA). A nearly three-fold difference in the ratio of two-photon fluorescence of the two dyes is achieved, without a drop in signal of the favored fluorophore. Implementing an acousto-optic interferometer, we were able to prove that the mechanism of discrimination is second-harmonic tuning by the phase-shaped pulses to the relative maxima and minima of these cross-sections.