From my tests it seems not to affect the AI, only the human player. Otherwise it would not make much sense to bind it to a difficulty setting.
I could imagine, that there are different battle events that increase the retreat counter, and if that counter hits the specified threshold, the unit retreats. But this is speculation.