Grammar Highlighter
A custom AI action for Read Frog. Select an English sentence on a web page, or a line of Read Frog's video subtitles, and click the action. The popup colour-codes its grammar structures and language patterns. Hover or tap any highlight to see its name, what it is for, why it is used in this sentence, and more examples.
Examples
Hover or tap a highlight. Click a chip in the legend to hide that category. "Explanations" opens the full list. Grammar names are always English; the explanations follow Read Frog's target language.
How to read it
Tenses, the passive, infinitives and gerunds. The fill covers the whole verb phrase, such as "have been learning".
Conditionals, relative clauses and other clauses. Brackets show where a clause starts and ends, and leave the fills inside it readable.
Each kind has its own line style, so it can be told apart without relying on colour. Highlights can sit inside each other; an outer underline sits lower.
| Looks like | Category | Style, colour | Key |
|---|---|---|---|
| have seen | Present Perfect | fill, blue | pres-perf |
| have been waiting | Present Perfect Continuous | fill, purple | pres-perf-cont |
| arrived | Past Simple | fill, orange | past-simple |
| was raining | Past Continuous | fill, green | past-cont |
| had left | Past Perfect (and Past Perfect Continuous) | fill, teal | past-perf |
| will call | Future forms | fill, yellow | future |
| was built | Passive voice | fill, red | passive |
| to learn | Infinitives and gerunds | fill, brown | inf-ger |
| If it rains, we'll stay | Conditionals | brackets, pink | conditional |
| who lives here | Relative clauses | brackets, cyan | relative |
| because it was late | Other clauses (time, reason, contrast, noun clauses…) | brackets, slate | clause |
| give up | Phrasal verbs | solid underline, indigo | phrasal |
| make a decision | Collocations | dashed underline, olive | collocation |
| break the ice | Idioms | wavy underline, magenta | idiom |
| for two years | Prepositional phrases (time, duration, place…) | dotted underline, steel blue | prep |
| However | Linking words and discourse markers | box, coral | linking |
| by the way | Common expressions | double underline, gold | expression |
Present Simple, Present Continuous (used for now) and modal verbs are not highlighted, because they would cover almost every sentence.
Set it up
It takes about five minutes. Everything saves as you type; there is no Save button.
Open Read Frog's options, go to Custom AI Actions, click Add AI action and pick Blank.
Name and Icon:
Grammar Highlightertabler:highlightProvider: pick a strong model that supports structured output. Smaller models give wrong grammar labels and misquote words. The examples above used DeepSeek V4 Flash, which is about the minimum we would recommend.
System prompt: paste all of it.
You are an English grammar coach. You find the grammar structures and language patterns in an English text, so a learner can see each one highlighted in its own colour, and you explain them. ## Input and languages The text is the Selection: usually one to three sentences from an article, a web page or a video subtitle. - Write "why" and "rule" in {{targetLanguage}}. - Write "name", "form" and "examples" in English, always. ## Output format Both fields are strings. Each one holds a compact JSON array written out as text, with the quotes inside it escaped: "Highlights": "[{\"text\":\"have been learning\",…}]". Never put a bare array in a field. ## Categories Put exactly one of these keys in "cat". Mark only what is really there; most texts use only a few categories. Verb forms. Quote the verb phrase, from the first auxiliary to the main verb, with any words between them ("have never seen", "Have you finished"). - pres-perf: Present Perfect (have/has + past participle). - pres-perf-cont: Present Perfect Continuous (have/has been + -ing). - past-simple: Past Simple. Mark every Past Simple verb, including "was"/"were" used as the main verb. - past-cont: Past Continuous (was/were + -ing). - past-perf: Past Perfect and Past Perfect Continuous (had + past participle, had been + -ing). - future: Future forms: will, be going to, Present Continuous or Present Simple for plans and timetables, be about to, Future Continuous, Future Perfect. - passive: Passive voice in any tense, also after modals ("was built", "has been sold", "can be done"). A passive verb gets one item only, with cat "passive"; put the tense in its name ("Present Perfect passive"). - inf-ger: Infinitives and gerunds: "to" + verb, and -ing forms used as nouns or after verbs and prepositions ("enjoy reading", "before leaving"). Never the -ing of a continuous tense. Clauses. Quote the whole clause, from its first word to its last. - conditional: Conditionals. Quote the whole conditional, the if/unless clause and its result clause together ("If it rains, we will stay at home"). Name the type: Zero, First, Second, Third or Mixed conditional. - relative: Relative clauses, from the relative word (who, which, that, whose, where, when) to the end of the clause. Say "Defining" or "Non-defining" in the name. - clause: Other subordinate clauses: time, reason, contrast, purpose and result clauses (when…, because…, although…, so that…) and noun clauses (that…, what…, whether…). Never mark a main clause or a whole sentence as "clause". Word patterns: - phrasal: Phrasal verbs, a verb + particle with its own meaning ("give up", "look into"). When an object splits it, quote it with "…": "turned … down". - collocation: Strong collocations worth learning as one chunk ("make a decision", "heavy rain", "take a risk"). - idiom: Idioms whose meaning is not the sum of their words ("break the ice"). - prep: Prepositional phrases worth learning: time, duration, place and fixed phrases ("for two years", "in the morning", "at risk"). Give the specific kind in the name ("Duration expression", "Time expression"). Skip plain ones like "of the book". - linking: Linking words and discourse markers ("however", "although", "on the other hand", "as a result", "actually"). - expression: Common fixed expressions ("by the way", "no wonder", "as far as I know", "it's worth it"). Present Simple, Present Continuous (for now) and modal verbs are not marked on their own. ## Rules for "text" 1. Copy every quote character for character from the Selection, with its spelling, capitals and punctuation. Never correct, shorten or paraphrase it. 2. Quote the shortest span that shows the structure; for a clause or a conditional, the whole clause. 3. Spans may sit inside each other (a Past Simple verb inside a relative clause, a prepositional phrase inside a conditional), but two spans must never partly overlap. If they would, shorten one so that one contains the other, or leave one out. 4. List the items in the order their spans start in the Selection. When two start at the same word, list the longer one first. 5. When the same words appear more than once and you mean a later one, add "occurrence": n (1 is the first). 6. If the Selection is longer than about 120 words, mark only the most useful structures, at most 40 items. 7. If the Selection is not English, return [] in both fields. ## Examples In these examples "why" and "rule" are in English; write yours in {{targetLanguage}}. ### Example 1 Selection: I have been learning English for two years. Highlights: [{"text":"have been learning","cat":"pres-perf-cont","name":"Present Perfect Continuous","why":"The learning started two years ago and is still going on."},{"text":"for two years","cat":"prep","name":"Duration expression","why":"Says how long the action has lasted."}] Guide: [{"name":"Present Perfect Continuous","form":"have/has + been + -ing","rule":"An action that started in the past and continues now, often with for or since.","examples":["She has been working here since May.","How long have you been waiting?"]},{"name":"Duration expression","form":"for + a period of time","rule":"For gives the length of time; since gives the starting point.","examples":["We stayed there for a week.","I haven't seen him for ages."]}] ### Example 2 Selection: If the bridge had been finished on time, the people who live nearby wouldn't have given up hope. Highlights: [{"text":"If the bridge had been finished on time, the people who live nearby wouldn't have given up hope","cat":"conditional","name":"Third conditional","why":"Imagines a different past: the bridge was not finished on time."},{"text":"had been finished","cat":"passive","name":"Past Perfect passive","why":"The bridge receives the action, and it comes before the other past event."},{"text":"on time","cat":"prep","name":"Fixed time phrase","why":"Means at the planned time."},{"text":"who live nearby","cat":"relative","name":"Defining relative clause","why":"Tells us which people."},{"text":"given up","cat":"phrasal","name":"Phrasal verb","why":"Give up means stop trying or stop hoping."}] Guide: [{"name":"Third conditional","form":"If + had + past participle, would have + past participle","rule":"An imagined past that did not happen, and its imagined result.","examples":["If I had known, I would have called you.","We would have won if he hadn't got injured."]},{"name":"Past Perfect passive","form":"had been + past participle","rule":"A passive action finished before another moment in the past.","examples":["The tickets had been sold before we arrived.","The room had been cleaned."]},{"name":"Fixed time phrase","form":"on time / in time","rule":"On time means at the planned time; in time means early enough.","examples":["The train left on time.","We got there just in time."]},{"name":"Defining relative clause","form":"noun + who/which/that + clause","rule":"Identifies which person or thing we mean; no commas.","examples":["The woman who called is my aunt.","I lost the book that you lent me."]},{"name":"Phrasal verb","form":"give up (+ noun / -ing)","rule":"Give up means stop doing or stop hoping for something.","examples":["Don't give up now.","He gave up smoking last year."]}]Prompt: replace what the Blank template put there.
## Input Selection: {{selection}} Target language: {{targetLanguage}}Output schema: the Blank template starts with one field named Result. Click it and rename it to
Highlights, then click Add field forGuide. Keep this order:# Field name Field type 1 HighlightsText 2 GuideText A compact JSON array serialized as a string, one item per structure in the Selection, in the order their spans start: {"text": the span copied character for character from the Selection, "cat": one category key from the system prompt, "name": the structure's specific English name in at most 5 words, "why": why it is used in this sentence, in {{targetLanguage}}, at most 20 words}. Add "occurrence": n only to point at a later repeat of the same words. Example: [{"text":"have been learning","cat":"pres-perf-cont","name":"Present Perfect Continuous","why":"The learning started in the past and is still going on."}]A compact JSON array serialized as a string, one item per distinct name used in Highlights, in the same order: {"name": exactly the name used in Highlights, "form": its pattern in English, e.g. "have/has + been + -ing", "rule": what the structure is for, in {{targetLanguage}}, at most 25 words, "examples": an array of two new short English example sentences}. Example: [{"name":"Present Perfect Continuous","form":"have/has + been + -ing","rule":"An action that began in the past and continues now.","examples":["She has been working here since May.","How long have you been waiting?"]}]Layout: click Edit under Layout, replace everything in the editor with this, and check the preview. The editor should show no warnings.
<style> /* Colours: change any value. This block is for light mode, the next one for dark mode. */ :host{ --pres-perf:oklch(0.6 0.19 258); --pres-perf-cont:oklch(0.56 0.22 305); --past-simple:oklch(0.72 0.18 55); --past-cont:oklch(0.68 0.19 145); --past-perf:oklch(0.66 0.12 190); --future:oklch(0.88 0.18 98); --passive:oklch(0.62 0.23 25); --inf-ger:oklch(0.56 0.09 60); --conditional:oklch(0.64 0.24 350); --relative:oklch(0.7 0.15 220); --clause:oklch(0.58 0.03 260); --phrasal:oklch(0.52 0.22 275); --collocation:oklch(0.6 0.16 128); --idiom:oklch(0.58 0.25 328); --prep:oklch(0.58 0.14 240); --linking:oklch(0.64 0.2 35); --expression:oklch(0.68 0.15 80); } :host([data-theme=dark]){ --pres-perf:oklch(0.7 0.16 258); --pres-perf-cont:oklch(0.7 0.18 305); --past-simple:oklch(0.76 0.16 55); --past-cont:oklch(0.76 0.17 145); --past-perf:oklch(0.76 0.11 190); --future:oklch(0.88 0.16 98); --passive:oklch(0.7 0.2 25); --inf-ger:oklch(0.7 0.08 60); --conditional:oklch(0.74 0.19 350); --relative:oklch(0.8 0.12 220); --clause:oklch(0.72 0.03 260); --phrasal:oklch(0.72 0.17 275); --collocation:oklch(0.78 0.15 128); --idiom:oklch(0.74 0.2 328); --prep:oklch(0.74 0.12 240); --linking:oklch(0.76 0.16 35); --expression:oklch(0.82 0.13 80); } [data-c]{--c:var(--rf-ring)} [data-c=pres-perf]{--c:var(--pres-perf)} [data-c=pres-perf-cont]{--c:var(--pres-perf-cont)} [data-c=past-simple]{--c:var(--past-simple)} [data-c=past-cont]{--c:var(--past-cont)} [data-c=past-perf]{--c:var(--past-perf)} [data-c=future]{--c:var(--future)} [data-c=passive]{--c:var(--passive)} [data-c=inf-ger]{--c:var(--inf-ger)} [data-c=conditional]{--c:var(--conditional)} [data-c=relative]{--c:var(--relative)} [data-c=clause]{--c:var(--clause)} [data-c=phrasal]{--c:var(--phrasal)} [data-c=collocation]{--c:var(--collocation)} [data-c=idiom]{--c:var(--idiom)} [data-c=prep]{--c:var(--prep)} [data-c=linking]{--c:var(--linking)} [data-c=expression]{--c:var(--expression)} /* Clicking a legend chip hides that category. */ :host([data-toggles~=hide-pres-perf]) .m[data-c=pres-perf], :host([data-toggles~=hide-pres-perf-cont]) .m[data-c=pres-perf-cont], :host([data-toggles~=hide-past-simple]) .m[data-c=past-simple], :host([data-toggles~=hide-past-cont]) .m[data-c=past-cont], :host([data-toggles~=hide-past-perf]) .m[data-c=past-perf], :host([data-toggles~=hide-future]) .m[data-c=future], :host([data-toggles~=hide-passive]) .m[data-c=passive], :host([data-toggles~=hide-inf-ger]) .m[data-c=inf-ger], :host([data-toggles~=hide-conditional]) .m[data-c=conditional], :host([data-toggles~=hide-relative]) .m[data-c=relative], :host([data-toggles~=hide-clause]) .m[data-c=clause], :host([data-toggles~=hide-phrasal]) .m[data-c=phrasal], :host([data-toggles~=hide-collocation]) .m[data-c=collocation], :host([data-toggles~=hide-idiom]) .m[data-c=idiom], :host([data-toggles~=hide-prep]) .m[data-c=prep], :host([data-toggles~=hide-linking]) .m[data-c=linking], :host([data-toggles~=hide-expression]) .m[data-c=expression]{--c:transparent;--open:none;--close:none;cursor:auto} .legend{display:flex;flex-wrap:wrap;gap:4px;margin:0 0 10px} .chip{display:inline-flex;align-items:center;gap:6px;margin:0;padding:2px 8px 2px 5px;border:1px solid var(--rf-border);border-radius:999px;background:transparent;color:var(--rf-popover-foreground);font:inherit;font-size:12px;line-height:18px;cursor:pointer} .chip:hover{background:var(--rf-secondary)} .chip:focus-visible{outline:2px solid var(--rf-ring);outline-offset:-2px} .chip[aria-pressed=true]{color:var(--rf-muted-foreground);text-decoration:line-through} .chip .n{color:var(--rf-muted-foreground);font-variant-numeric:tabular-nums} .chip .m{font-size:11px;line-height:14px;cursor:inherit} .text{margin:0;font-size:15px;line-height:2.15} .m{border-radius:3px;cursor:help;-webkit-box-decoration-break:clone;box-decoration-break:clone} .m:is([data-c=pres-perf],[data-c=pres-perf-cont],[data-c=past-simple],[data-c=past-cont],[data-c=past-perf],[data-c=future],[data-c=passive],[data-c=inf-ger]){padding:2px 2px;background:color-mix(in oklab, var(--c) 30%, transparent)} :host([data-theme=dark]) .m:is([data-c=pres-perf],[data-c=pres-perf-cont],[data-c=past-simple],[data-c=past-cont],[data-c=past-perf],[data-c=future],[data-c=passive],[data-c=inf-ger]){background:color-mix(in oklab, var(--c) 34%, transparent)} .m:is([data-c=conditional],[data-c=relative],[data-c=clause]){--open:"[";--close:"]"} .m:is([data-c=conditional],[data-c=relative],[data-c=clause])::before{content:var(--open);margin-right:1px;color:var(--c);font-weight:700} .m:is([data-c=conditional],[data-c=relative],[data-c=clause])::after{content:var(--close);margin-left:1px;color:var(--c);font-weight:700} .m:is([data-c=phrasal],[data-c=collocation],[data-c=idiom],[data-c=prep],[data-c=expression]){text-decoration-line:underline;text-decoration-color:var(--c);text-decoration-thickness:2px;text-underline-offset:calc(4px + var(--h, 0) * 5px);text-decoration-skip-ink:none} .m[data-c=collocation]{text-decoration-style:dashed} .m[data-c=idiom]{text-decoration-style:wavy;text-decoration-thickness:1.5px} .m[data-c=prep]{text-decoration-style:dotted;text-decoration-thickness:3px} .m[data-c=expression]{text-decoration-style:double;text-decoration-thickness:1.5px} .m[data-c=linking]{padding:0 2px;outline:1.5px solid var(--c);outline-offset:0} .t-name{font-weight:600} .t-cat{color:var(--rf-muted-foreground)} .t-form{display:block;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px;color:var(--rf-muted-foreground)} .t-rule{display:block;margin-top:3px} .t-why{display:block;margin-top:5px;padding-left:7px;border-left:2px solid var(--c)} .t-ex{display:block;margin-top:3px;font-style:italic;color:var(--rf-muted-foreground)} .status{margin:6px 0 0;font-size:12px;color:var(--rf-muted-foreground)} :host([data-status=streaming]) .status{animation:gh-pulse 1.6s ease-in-out infinite} @keyframes gh-pulse{50%{opacity:0.45}} .more{margin:10px 0 0;padding:0;border:0;background:none;color:var(--rf-muted-foreground);font:inherit;font-size:12px;font-weight:500;cursor:pointer} .more:hover{color:var(--rf-popover-foreground)} .more::after{content:" ▾"} :host([data-toggles~=guide]) .more::after{content:" ▴"} .guide{display:none;margin-top:6px} :host([data-toggles~=guide]) .guide{display:block} .g{padding:8px 0;border-top:1px solid var(--rf-border)} .g-head{display:flex;flex-wrap:wrap;align-items:baseline;column-gap:8px} .g-name{font-weight:600} .g-form{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;color:var(--rf-muted-foreground)} .g-rule{margin-top:2px} .g-used{margin-top:2px;font-size:12px;color:var(--rf-muted-foreground)} .g-ex{margin:4px 0 0;padding-left:16px;font-size:13px;font-style:italic;color:var(--rf-muted-foreground)} </style> {%- assign keys = "pres-perf,pres-perf-cont,past-simple,past-cont,past-perf,future,passive,inf-ger,conditional,relative,clause,phrasal,collocation,idiom,prep,linking,expression" | split: "," -%} {%- assign labels = "Present Perfect|Present Perfect Continuous|Past Simple|Past Continuous|Past Perfect|Future forms|Passive voice|Infinitives & gerunds|Conditionals|Relative clauses|Other clauses|Phrasal verbs|Collocations|Idioms|Prepositional phrases|Linking words|Common expressions" | split: "|" -%} {%- assign items = ["Highlights"] | parse_json -%} {%- assign guide = ["Guide"] | parse_json -%} {%- assign parts = ctx.selection | annotate: items -%} {%- if items.size > 0 -%} <div class="legend" data-rf-key="legend"> {%- for k in keys -%} {%- assign hits = items | where: "cat", k -%} {%- if hits.size > 0 -%} <button type="button" class="chip" data-toggle="hide-{{ k }}" title="Show or hide {{ labels[forloop.index0] }}"><span class="m" data-c="{{ k }}">Aa</span>{{ labels[forloop.index0] }}<span class="n">{{ hits.size }}</span></button> {%- endif -%} {%- endfor -%} </div> {%- endif -%} <p class="text" data-rf-key="text"> {%- for e in parts -%} {%- if e.kind == "enter" -%} {%- assign g = guide | find: "name", e.item.name -%} <span class="m" data-c="{{ e.item.cat }}" data-tip style="--h:{{ e.height | default: 0 }}"><span data-tip-body><span class="t-name">{{ e.item.name }}</span> {%- assign plural = e.item.name | downcase | append: "s" -%} {%- for k in keys -%}{%- assign label = labels[forloop.index0] -%}{%- assign lower = label | downcase -%}{%- if k == e.item.cat and lower != plural %} <span class="t-cat">· {{ label }}</span>{%- endif -%}{%- endfor -%} {%- if g.form -%}<span class="t-form">{{ g.form }}</span>{%- endif -%} {%- if g.rule -%}<span class="t-rule">{{ g.rule }}</span>{%- endif -%} {%- if e.item.why -%}<span class="t-why" data-c="{{ e.item.cat }}">{{ e.item.why }}</span>{%- endif -%} {%- for x in g.examples -%}<span class="t-ex">{{ x }}</span>{%- endfor -%} </span> {%- elsif e.kind == "leave" -%}</span> {%- else -%}{{ e.text }}{%- endif -%} {%- endfor -%} </p> {%- if ctx.status == "streaming" -%} <p class="status">{% if guide.size > 0 %}Writing explanations…{% else %}Finding structures…{% endif %}</p> {%- elsif ctx.status == "done" -%} {%- unless items.size > 0 -%}<p class="status">No structures found. Select an English sentence.</p>{%- endunless -%} {%- endif -%} {%- if guide.size > 0 -%} <button type="button" class="more" data-toggle="guide">Explanations ({{ guide.size }})</button> <div class="guide" data-rf-key="guide"> {%- for g in guide -%} {%- assign first = items | find: "name", g.name -%} {%- assign used = items | where: "name", g.name | map: "text" | join: " · " -%} <div class="g"> <div class="g-head"><span class="g-name"><span class="m" data-c="{{ first.cat }}">{{ g.name }}</span></span>{%- if g.form -%}<span class="g-form">{{ g.form }}</span>{%- endif -%}</div> {%- if g.rule -%}<div class="g-rule">{{ g.rule }}</div>{%- endif -%} {%- if used != "" -%}<div class="g-used">In this text: {{ used }}</div>{%- endif -%} {%- if g.examples.size > 0 -%}<ul class="g-ex">{%- for x in g.examples -%}<li>{{ x }}</li>{%- endfor -%}</ul>{%- endif -%} </div> {%- endfor -%} </div> {%- endif -%}Use it. Select one to three English sentences and click the highlighter icon in the selection toolbar. For videos, turn on Read Frog's subtitles, pause, and select a subtitle line the same way.
Customise it
Colours
The first two blocks of the Layout list one colour per category: the first block for light mode, the second for dark mode. Change any value; any CSS colour works, such as --past-simple:#f97316;. The key column above gives each category's variable name.
Turn a category off
For one popup: click its chip in the legend. For good: delete its line from the Categories part of the System prompt (for example the line that starts with - idiom:). The model stops looking for it, and it disappears from the legend.
Explanation language
The explanations ("why" and "rule") follow Read Frog's target language, the one you translate into. Grammar names, patterns and example sentences stay in English.
Save results to a Notebase
Optional: on the Notebase tab you can save each result as a row. Both fields hold JSON text, so this is mostly useful as a raw log.
Good to know
- It works on what you select, in the popup. It does not highlight a whole page or the subtitles under a video by itself. That would be a new extension feature, a lot like the difficult-words scan.
- Speed depends on the model. A reasoning model thinks before it answers. With DeepSeek V4 Flash these examples took 2.3–36 s, mostly thinking; the highlights then appear first and the explanations stream in after them.
- Long selections are trimmed. Above about 120 words the model marks at most 40 structures, the most useful ones.
- The legend's on/off choices are forgotten when the popup closes.
- Labels can be wrong. They come from the model. In these 14 answers, for example, the Chinese run of the paragraph example did not mark "cut down" as a phrasal verb.
How the examples were made
Each example was sent to deepseek-flash in JSON mode, with the System prompt, the output contract Read Frog appends to it, and the Prompt built exactly as the extension builds them. The first run returned one answer (of 14) with its fields as raw JSON arrays instead of strings, which Read Frog would reject as invalid. After adding the "Output format" rule to the System prompt, 28 of 28 answers came back as strings. All 90 highlights in the answers shown here were found in their sentences. The layout lints clean and renders each streaming frame in under 2 ms.