1 way in can think of is using a GridView's OnRowDataBound event. In your grid, include an empty column, with say a Panel in it. Give the panel an ID.
Then using something like this, find the panel in the grid, and using the value of the rating field of the current item being bound, add images:
void YourGrid_RowDataBound(Object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType == DataControlRowType.DataRow)
{
SPListItem item = (SPListItem)e.Row.DataItem;
Panel stars = e.Row.Cells[?].FindControl("StarsPanel") as Panel;
if(stars != null)
{
int rating = 0;
int.TryParse(item["Rating"].Tostring(), out rating);
for(int i = 0; i < rating)
{
//add images
{
}
}
}