Back to 9Minecraft
Wiki 9Minecraft Wiki 9Minecraft
Better Highlighting Wiki › Guides › Adjust Grammar Rules Through Resource Packs

Adjust Grammar Rules Through Resource Packs

What Grammar Rules Control

Grammar rules define how the mod interprets command syntax—which elements are commands, which are arguments, how selectors work, and what constitutes valid syntax. By modifying grammar through resource packs, you can extend highlighting to custom commands or adjust how existing commands are parsed.

Creating Grammar Files

In your resource pack's assets/betterhighlighting/ folder, create a grammar directory. Grammar files use a structured format that defines:

  • Command patterns and their arguments
  • Argument types and their valid values
  • Selector syntax and properties
  • Special syntax rules

Applying Custom Grammar

Reference the mod's default grammar structure to understand the format. Make incremental changes—add support for a single custom command first, then test it in-game by typing the command in chat or a command block.

Testing Your Changes

Enable your resource pack and reload. Type commands to verify they highlight correctly. If highlighting doesn't match your grammar rules, double-check JSON syntax and ensure file paths are correct. Invalid grammar files may cause the mod to fall back to defaults.