Hydraulic fluid needs to be kept clean of foreign debris to avoid damaging/destroying hydraulic fluid lines. It is also known to be hydrophillic; Absorbing water leads to a lower boiling point, which can introduce air into the system and render it incapable of functioning. To this end, caps for hydraulic fluid reservoirs incorporate some sort of seal to inhibit dirt and water from entering the system.
There are a number of different styles of cap that seem to be prevalent across different manufacturers, see images:
[Ford]: https://i.sstatic.net/lFHT8.jpg
[Dumptruck]: https://i.sstatic.net/vEluX.jpg
[Mercedes/GM but I can't get the GM photo to upload]: https://i.sstatic.net/RdLVJ.jpg
The first 2 have small inlets that allow for the reservoir to equalize pressure (Or at least I assume that is what the tiny holes are for). The last one does not seem to have any such inlets, just the rubber seal.
Why are these holes in the caps? Why do some applications have inlets and some do not?