It was recently proved that any straight-line program (SLP) generating a given string can be transformed in linear time into an equivalent balanced SLP of the same asymptotic size. We generalize this proof to a general class of grammars we call generalized SLPs (GSLPs), which allow rules of the form \(A \rightarrow x\) where x is any Turing-complete representation (of size |x|) of a sequence of symbols (potentially much longer than |x|). We then specialize GSLPs to so-called Iterated SLPs (ISLPs), which allow rules of the form \(A \rightarrow \Pi _{i=k_1}^{k_2} B_1^{i^{c_1}}\cdots B_t^{i^{c_t}}\) of size \(\mathcal {O}(t)\) . We prove that ISLPs break, for some text families, the measure \(\delta \) based on substring complexity, a lower bound for most measures and compressors exploiting repetitiveness. Further, ISLPs can extract any substring of length \(\lambda \) , from the represented text \(T[1\mathinner {.\,.}n]\) , in time \(\mathcal {O}(\lambda + \log ^2 n\log \log n)\) . This is the first compressed representation for repetitive texts breaking \(\delta \) while, at the same time, supporting direct access to arbitrary text symbols in polylogarithmic time. We also show how to compute some substring queries, like range minima and next/previous smaller value, in time \(\mathcal {O}(\log ^2 n \log \log n)\) . Finally, we further specialize the grammars to run-length SLPs (RLSLPs), which restrict the rules allowed by ISLPs to the form \(A \rightarrow B^t\) . Apart from inheriting all the previous results with the term \(\log ^2 n \log \log n\) reduced to the near-optimal \(\log n\) , we show that RLSLPs can exploit balancedness to efficiently compute a wide class of substring queries we call “composable”—i.e., \(f(X \cdot Y)\) can be obtained from f(X) and f(Y). As an example, we show how to compute Karp-Rabin fingerprints of texts substrings in \(\mathcal {O}(\log n)\) time. While the results on RLSLPs were already known, ours are much simpler and require little precomputation time and extra data associated with the grammar.