Hi Raman,
Enhance your Transaction/Query that it will give data as below.
Then you can use the above method and set the color context Run time like this.
Grid.getGridObject().setMatchColors("Red,"Blue");
Grid.getGridObject().setMatchColumns("Color");
Grid.getGridObject().setMatchValues("String:EXACT_MATCH:Red;String:ExactMatch:Blue");
It will result in your grid like this :
Regards,
Sriram