Compression of non-adjacent structure using grammar
Grammar-based compression (context-free)  is alwasy looking for repetitions and is blind for other "patterns"..
In your example "XaXbXcYaYbYcZaZbZc" a position based compression should be more senseful.
For example the following "position rules" are generating your string..


  i=0,1,2:
  pos(X)=1+2i
  pos(Y)=pos(X)+6
  pos(Z)=pos(Y)+6
  pos(a)=2+6i
  pos(b)=pos(a)+2
  pos(c)=pos(b)+2  


Rules like that can be stored efficiently and they are easy to decompress.
(In general the best compression is not computable since the so-called Kolmogorov-complexity is not computable. It is always a question of the type of compression..)