I did some testing and I think I figured out what Flag 5&6 do on items:
They keep track of the amount of runestones and gems in your items, and also the second type of gem in an item.
Flag 5 ~ Runestone Amount /16 | Runestone Amount (Remainder of Num 1) | Nothing | Second Gem Type (Same As Flag 4 Num 2)
Flag 6 ~ Second Gem Amount/16 | Second Gem Amount (Remainder of Num 1) | First Gem Amount/16 | First Gem Amount (Remainder of Num 3)
So for example:
Flag 5 = 490C means an item has 4*16+9(=73) Runestones and has Jade as a second gem (C=Of Corruption=Jade)
Flag 6 = 2317 means the item has 2*16+3(=39) gems in the second slot and 1*16+7(=23) gems in the first slot
If someone wants to edit items to +15(max) with specific qualities and attributes, they need to change:
Flag 1 to +15
Flag 4 to first desired gem and desired item quality
Flag 5 to required runestone amount and second desired gem
Flag 6 to required second and first gem amounts
Runestone/Gem amounts are multiples of 16, so for +15 you need 176 of each in an item. You might notice that 176/16 is just 11, that's because the game adds +4 to the finished calculation if the gem/runestone count is equal to or greater than 16 (the first multiple of 16).
It does this because the +1...+4 range on items requires less gems/runestones than 16, so by the time you'd reach 16 of each, the item would already be at +4.
Edit: Forgot to thank you for the quick update @sanitka !