In chapter 3, Black Beauty describes how when he was four years old, he was broken in, or trained. During this period, a horse must learn to carry a person on its back, and it must also learn to "never start at what he sees." In other words, a horse must learn not to be startled by things which might make it jump, or "start." If the horse did not learn to "never start" then it would always be at risk of being startled and endangering the life of the person riding on its back.
To train Black Beauty not to be startled by trains, his master places him in a field next to a train track. In this field there are also sheep and cows. When Black Beauty first hears and sees a train going past the field, he is alarmed, and he gallops to the far side of the field "as fast as [he can] go." He stands at the far side of the field, as far away as possible from the train tack, and he snorts "with astonishment and fear." He imagines the train to be some manner of "terrible creature" which might intend to harm him.
Black Beauty recalls how, during the rest of the same day, he saw and heard many more trains pass by, some making an "awful shriek and groan" as they passed. He also recalls how he noticed that the sheep and cows made no fuss at all whenever a train passed by. The implication is that Black Beauty learned from the sheep and the cows that he didn't need to be afraid of the trains.