The high sensitivity Compton and Rayleigh X‐ray scattering signals can be used to gain valuable information on the chemical composition of various matrices, by exploiting the ratio of those signals as a function of the effective atomic number (Zeff). Neither total reflection X‐ray fluorescence (TXRF) nor the effect of the experimental setup, including sample preparation, X‐ray excitation source selection, and band deconvolution procedure, has been assessed in this kind of approach. Here, a Compton/Rayleigh ratio and Zeff‐based TXRF method was set up and tested as an analytical tool for milk samples differentiation. The method was developed using a 90° scattering angle and assessed using different X‐ray excitation sources: a molybdenum tube (Mo Kα 17.5 KeV) and a tungsten tube (W Lα 8.5 KeV and W‐Brems 35 KeV). The evaluation of independent Compton and Rayleigh signals was performed by non‐Gaussian and Gaussian curve resolution methods, and both height and area‐based calculations were evaluated. Different sample preparation conditions were assessed. By using 11 standard materials, a calibration curve for Compton/Rayleigh ratio versus Zeff was established. The method was tested to determine the Zeff of milk samples, which enabled its use as a parameter to differentiate them. Good precisions were obtained with the Mo excitation source and the area‐based calculations, which allowed to differentiate undiluted milk samples by species, treatment, and fat content according to their Compton/Rayleigh ratio. This simple and rapid method has the potential to be used for the differentiation of various types of samples, including liquids, solids, and aerosols.