This is covered in the Animals Act 1971 Chapter 22: "An Act to make provision with respect to civil liability for damage done by animals and with respect to the protection of livestock from dogs; and for purposes connected with those matters." http://www.legislation.gov.uk/ukpga/1971/22
The use of the roads by livestock under control is legal. If a cow damaged a car when a herd of cows was being moved, the driver could probably make the case that it is the farmers fault, as they are using and operting on the highway in much the same way as any other traffic: car, truck, horse drawn carraige, etc. And much the same way if the farmer was driving a car and collided by his own fault with the driver.
In the US West, "Open Range" laws can work in the opposite manner; in some cases, you hit a cow, you pay for it, and pay for the damage to your own vehicle. See https://en.wikipedia.org/wiki/Open_range