OK, so imagine something like this:
B C F
F F F F F
F F A F F D
F F F F F
A= character starting position
F = lit tile
B, C, D = tiles where character can move
If you tell the character to go to B, it will take the shortest route, which is a 2 diagonal movements. It will thus step into the fire only once.
Similarly with C: it will take one diagonal movement and one up, or in reverse order, always taking damage only once.
To go to D, however, it has to step on two lit tiles, so it will take the damage twice.