best way to do that is with php and mysql.
For comments, you would need a form to submit comments into a mysql database to store the comments. then to display them, you will need a php program to extract the info from the database and insert it into the comments page.
a rating system would be very similar.....