GridBoundRecordState state = this.grid.Binder.GetRecordStateAtRowIndex(rowIndex);
int levelIndex = state.LevelIndex;
Then you can use
GridHierarchyLevel level = this.grid.Binder.GetHierarchyLevel(levelIndex)
to get the GridHierarchyLevel if you know the level index you want.
if(e.RowIndex > grid.Model.Rows.HeaderCount)
{
GridBoundRecordState state = this.grid.Binder.GetRecordStateAtRowIndex(rowIndex);
int levelIndex = state.LevelIndex;
if(levelIndex == 0)
e.Style.BackColor = Color.Red;
else if(levelIndex == 1)
e.Style.BackColor = Color.Blue;
else
e.Style.BackColor = Color.Green;
}