Ya lo he solucionado.En el evento OnDrawCell pongo el siguiente código:
void __fastcall TVentanaInstalacion::PintarAlarmas(TObject *Sender,
int ACol, int ARow, TRect &Rect, TGridDrawState State)
{
if (StringGrid3->Cells[ACol][ARow]>StringGrid2->Cells[ACol][ARow])
Pintar_Celda(ACol,ARow,0,StringGrid3);
else if (StringGrid3->Cells[ACol][ARow]<StringGrid2->Cells[ACol][ARow])
Pintar_Celda(ACol,ARow,1,StringGrid3);
}
Para que no haya problemas con la ScrollBar, en el evento OnTopLeftChanged porngo el siguiente código:
void __fastcall TVentanaInstalacion::Scroll(TObject *Sender)
{
TGridDrawState State;
TRect rectangulo;
for (int col=1;col<StringGrid3->ColCount;col++) {
for (int fila=StringGrid3->TopRow;fila<StringGrid3->RowCount;fila++) {
PintarAlarmas(Sender,col,fila,rectangulo,State);
}
}
}
Lo pongo por si a alguien le sirve para algo.
Saludos!