You can do this on CellFormatting event like below.
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (this.dataGridView1.Columns[e.ColumnIndex].Name == "ColumnName")
{
if (e.Value != null)
{
string stringValue = (string)e.Value;
if (stringValue == "5")
{
e.CellStyle.BackColor = Color.Red;
}
}
}
}