Sunroof is when the piece is not made out of glass, it's part of the body of the car. Moonroof is when the piece is deeply tinted glass so you can see out the top all day long (and usually includes a sun shade). Nowadays, people just use both terms to refer to them so there's is no right or wrong really, but those are what they technically mean.