The melting temperature of the amplicon at which the two DNA strands come apart is entirely predictable. It is dependent on the sequence of the DNA bases. If you are comparing two samples from two different people, they should give exactly the same shaped melt curve.  However, if one person has a mutation in the DNA region you have amplified, then this will alter the temperature at which the DNA strands melt apart.  So now the two melt curves appear different.  The difference may only be tiny, perhaps a fraction of a degree, but because the HRM machine has the ability to monitor this process in "high resolution", it is possible to accurately document these changes and therefore identify if a mutation is present or not.