Diesels do not have the hydrocarbon vapor issues that gas tractors do but they still pull a slight vacuum to keep the vapors in. If the tank is a closed volume and you are running the engine there is going to be fuel used and a vacuum created.
In the old days the fuel caps had a hole in them with a baffle to keep it from splashing and dirt out. This kept the pressure virtually equalized. The issue is that as the fuel heated, either by temperature changes or engine heat, it expanded and created a pressure in the tank - again with a vented gas cap no issue. Modern fuel systems attempt to capture those vapors and run them through the engines, i.e. the valve is more of a check valve with a pressure relief for safety.
Yes - when you open the cap the hydrocarbon vapors can come out but most do not for a lot of reasons, the biggest one being that as the pressure increases due to the seal of the cap being broken air goes in not the other direction - which is why they like to keep a slight vacuum.
Tractor fuel systems are not nearly as sophisticated as an automobile's, but they are doing some things to keep the hydrocarbon vapors out of the environment.