You got me. The best I can tell, it is filled with charcoal to clean the gasoline fumes before they get back to the fuel tank. I'm not sure, though.
Correct assumption. With the engine stopped, the charcoal in the canister traps gas fumes that would escape into the atmosphere if the tank was vented. It then releases the trapped fumes into the engine to be burned when running, by way of a Purge Valve that connects the tank to the intake manifold when the RPM's go above 2K or so.