When air flows through the edges of carpets, the carpet acts as a filter and collects whatever is in the air. Hence we often find dirt streaks around heating outlets where some of the air sneaks under the grill and through the rug.
Often, streaks are found near baseboards where household air flows either in or out of the house with the drafts. Usually, these dirty marks can be cleaned, and they can be stopped by sealing the air leaks that blow through the rugs.
In the case of the walls, remove the quarter round and simply caulk the wall to the floor.
With the heating grill, put some self adhesive foam strips between the floor grill and the ductwork.
Candles can be the culprit
A most interesting thing has come to light with this problem, that of permanent carbon marks on rugs. It took quite a lot of hunting, but finally researchers discovered that this is often caused by burning candles in the home. The problem has increased with the wide variety of New Age candles available everywhere.
Poor wax, too many colorants and odourants, or a bad wick can cause the creation of carbon soot. The rug becomes a primary collector wherever drafts cause the air to filter through the rug fibres.
To test your candles for carbon discharge, the CMHC as come up with a simple test. Clean your TV screen. Put the questionable candle on top of the TV. Light the candle and the TV both for several hours, then wipe the screen with a white cloth. If it is collecting black soot, your candles are a problem.
There used to be a great series of pamphlets that talk about all kinds of things including the candle/rug problem on the CMHC web site under the publication heading: About Your House -- but Harper shut down the CMHC research department and eleminated all of their publications -- a great loss to Canadian homeowners.
If you have an forced air oil fueled furnace and the candle test shows candles to not be the source, then have a furnace technician check your furnace heat exchanger for a leak. A heat exchanger leak not only sends black soot into the duct system, but sends dangerous gasses throughout your house. This may require changing the entire furnace.