Specifically, what causes them, what sort of damage can they cause, and what are the differences in their composition?
The following definitions are according to NASA.
"Solar Flares" are gigantic explosions from the surface of the Sun, occurring near sunspots along the dividing/neutral line between opposite magnetic field areas.
"Coronal Mass Ejections" (CME's) are:
Although the Earth's magnetic field protects the biosphere from the worst of these forms of 'space weather', according to the website "Space Weather: What impact do solar flares have on human activities?", the effects that do affect us are:
From the Solar Weather site, an important distinction between CME's and solar flares in how they affect the Earth:
Very severe CME's can also potentially disrupt power grids and communications.