Welcome!
It is for what is commonly known as the rollover valve.
It is a vent, set in a grommet, that connects to the evaporative emissions canister.
It acts as a check/float valve as well.
So if the tank is filled up into the filler neck, raw fuel won't end up in the engine.
And if the vehicle flips over in a crash it will not pour fuel out.
Jim,
Lil'Red is a '87 F250 HD, 4.10's, 1356 4x4, Zf-5, 3G, PMGR, Saginaw PS, desmogged with a Holley 80508 and Performer intake.
Too much other stuff to mention.