Here's the breakdown:
* "Cattle" is the noun, the subject of the sentence.
* "Grazing" is the present participle of the verb "graze," acting as an adjective modifying "cattle."
* "in evening dusk" and "headed toward the barn" are prepositional phrases further describing the cattle's action.
The entire phrase functions as a participial phrase, modifying the noun "cattle" and telling us what they are doing.