From Characters to Tokens: Dynamic Grouping with Hierarchical BPE