The key bit is that the rate of heat loss (which is really the rate at which energy flows out of the tea in the cup) depends on the temperature difference between the tea and the surrounding air, the thermal conductivity of the cup and the surface it's resting on.
There is a fixed quantity of heat energy in each cup at the start, as they each have the same volume of tea at the same temperature. If milk is added first, then when the tea is added the initial temperature of that cup will be lower, because it will mix with the cool milk. If milk is added later than the initial temperature will be higher, until the time where the milk is added.
This means that in that initial period the cup with no milk will lose a lot more heat energy up to the point where the milk is added. From then on it's rate of heat energy loss drops, because the temperature differential has reduced. The cup that already had the milk in will start at a lower initial temperature so will not suffer that additional higher initial energy loss rate.
The cooling curve was measured by Newton (and is referred to as Newton's Law of Cooling) and you can see more detail on it here: https://en.wikipedia..._law_of_cooling