As everyone has mentioned. It's different line ending style. MacOSX uses Unix line endings - i.e. LF (line feed).
Windows uses both CR (carriage return) & LF (line feed) as a line ending. Since you're using both windows and mac thats where the problem stems from.
If you create a file in windows and then bring it onto the mac you might see these ^M characters at the end of the lines.
If you want to remove them you can do this very easily in emacs. Just highlight and copy the ^M character and do a query-replace ^M with and you'e done.
EDIT: Some other links that may be of help. http://xahlee.org/emacs/emacs_adv_tips.html
This one helps you configure emacs to use a particular type of line-ending style. http://www.emacswiki.org/emacs/EndOfLineTips