Can a CSV file have a comment?
The CSV "standard" (such as it is) does not dictate how comments should be handled, no, it's up to the application to establish a convention and stick with it.
In engineering data, it is common to see the #
symbol in the first column used to signal a comment.
I use the ostermiller CSV parsing library for Java to read and process such files. That library allows you to set the comment character. After the parse operation you get an array just containing the real data, no comments.
No, CSV doesn't specify any way of tagging comments - they will just be loaded by programs like Excel as additional cells containing text.
The closest you can manage (with CSV being imported into a specific application such as Excel) is to define a special way of tagging comments that Excel will ignore. For Excel, you can "hide" the comment (to a limited degree) by embedding it into a formula. For example, try importing the following csv file into Excel:
=N("This is a comment and will appear as a simple zero value in excel")
John, Doe, 24
You still end up with a cell in the spreadsheet that displays the number 0, but the comment is hidden.
Alternatively, you can hide the text by simply padding it out with spaces so that it isn't displayed in the visible part of cell:
This is a sort-of hidden comment!,
John, Doe, 24
Note that you need to follow the comment text with a comma so that Excel fills the following cell and thus hides any part of the text that doesn't fit in the cell.
Nasty hacks, which will only work with Excel, but they may suffice to make your output look a little bit tidier after importing.