Sedimentary rock
Coal: peat to anthracite
At least 50% organic matter by weight, formed mostly from plant debris preserved as peat in swamps. With burial, heat (more than pressure or time) drives off water and volatiles and raises the carbon content: peat → lignite (brown coal) → sub-bituminous → bituminous (dense, black, often with bright and dull bands; about 84% carbon) → anthracite (hard, glossy, highest carbon, conchoidal fracture). About 90% of coal beds were deposited in the Carboniferous and Permian.
How it forms (petrogenesis)
In wetlands, dead plant matter protected from oxidation by mud or acidic water built up as peat. Deep burial by sediment then drove off water, methane and carbon dioxide (coalification); temperature matters more than pressure or time. Widespread Carboniferous–Permian wetlands account for 90% of coal beds.
Source: Wikipedia: Coal
In thin section
Coal contains different plant materials (macerals) that can be identified under the microscope.

Photos are hosted by their original sites and shown under their open licenses (CC BY, CC BY-SA, public domain or Open Government Licence). Click a photo for its source page.
Other sedimentary rocks
Conglomerate and breccia · Quartz arenite · Arkose · Lithic arenite · Wacke (greywacke) · Mudrocks: shale, mudstone, siltstone, claystone · Limestone · Chalk · Coquina · Oolite · Travertine and tufa · Dolostone · Chert · Diatomite · Radiolarite · Evaporites: rock salt and gypsum · Banded iron formation · Oil shale
Sources
Rygel & Quinton, Sedimentary Geology 7.3: Organic-Rich Sedimentary Rocks · Wikipedia: Coal · Wikipedia: Coal