The exercise I found has this language $L=\{a^ib^jc^k: k=i \cdot j\}$ on the alphabet $\Sigma = \{a, b, c\}$, and although it has nothing to do with creation of grammars, I decided to give it a try.
My ideia is to define equal amounts of $a's$ and $b's$ as I add a counter for $c's$ (something like $S \rightarrow aSbC | \varepsilon$), then add the extra $a's$ or $b's$ also with a counter (with something like $S \rightarrow A$ and $A \rightarrow aAD | \varepsilon$; analogous for $b's$). Adding some rules to rearrange (something like $Cb \rightarrow bC$), I would be able to generate strings of the form $aa..aabb...bbCC..CCDD...DD$ (with say $k+m$ number of $a's$, $k$ number of $b's$, $k$ number of $C's$ and $m$ number of $D's$).
To end this quest, I now only need to transform the string $CC..CCDD...DD$ of $k$ number of $C's$ and $m$ number of $D's$ into $k(k+m)$ number of c's.
Although I just glanced over some rules, I am anyway stuck at this final step, so any light would be of great help.
This is not a context-free language, so no grammar is possible.
Consider the pumping lemma for context-free languages: to use it to disprove that $L$ is context-free, we take an arbitrary $p\in\mathbb{N}$ and show that it is not a valid pumping length. That is, for some string $s$ of length $\ge p$, no division $s=uvwxy$ such that $|vx|\ge 1,|vwx|\le p$ satisfies the property that $uv^nwx^ny$ is always in $L$ (for any $n\in\mathbb{N}$).
Suppose for a contradiction that $p$ is a pumping length and let $s:=a^{p+1}b^{p+2}c^{(p+1)(p+2)}\in L$. Then there is some division $s=uvwxy$ satisfying the conditions above. But notice that $|vwx|\le p$, so $vwx$ cannot contain both of the symbols $a,c$ (the block of $b$s is longer than $p$). Because $vx$ is non-empty, $uv^2wx^2y(=uvvwxxy)$ contains more than $p+2$ instances of $b$ or more than $(p+1)(p+2)$ instances of $c$: in order that $uv^2wx^2y\in L$, we must have that both $b$ and $c$ blocks increase in length to preserve the multiplication.
So there are $\ge p+3$ instances of $b$, but then there must be $\ge (p+1)(p+3)$ instances of $c$. The number of $c$s added, however, is $\le |vx|\le |vwx|\le p$, and $(p+1)(p+3)-(p+1)(p+2)=p+1>p$, a contradiction.
So no context-free grammar will exist.
The language should "feel" intuitively like it is not going to be context-free, because you need to "remember" how many $a$s there have been in order to increment $c$ by the appropriate amount when $b$ increases by $1$ ($a(b+1)-ab=a$). In the context of your construction, $C$ and $D$ blocks would either need to "communicate with each other" to determine how many of each there are, or to hold "memory" about how may $C$s and $D$s there were when they were generated, but each block needs to be substituted independently by the same rule (i.e. "free of context").
However, your construction is a way to produce languages like $L=\{a^ib^jc^k:i+j=k\}$ or similar languages where $k=k_1i+k_2j$, as here $C$ and $D$ can be chosen without context, as each $C$/$D$ symbol represents the same number of $c$s.