The result, however it happens to be stored or presented to you, evidently will be the equivalent of one raster for each class: a raster showing the counts of type "A", another showing the counts of type "B", and so on.
Compute these count grids by taking focal statistics of the indicator grids.
Recall that the indicator for any class is a grid having ones for cells where the class exists and zeros elsewhere. Create indicators by equating the original grid with the individual class values. The focal sum over a 3 x 3 annular neighborhood (that is, omitting the center) thereby counts the cells of that type. (If you don't want to compute a focal sum for annular neighborhoods--finding it perhaps easier to compute the full 3 x 3 focal sum--simply subtract each indicator from its 3 x 3 focal sum!)
You have to iterate this workflow over all class types.