So many causes possibly several. The important take away is it's normal, it may or may not be preventable/treatable, but it's not a big deal either way.
Give his legs a good curry with a soft curry comb, that will clean it up well. A light layer of something like the Equiderma would work well too, but no "once or twice" do this regularly. It could be flies so keep an eye on that and flyspray if need be.