That will depend on the muzzle device. In general you will want to stay shorter than 13.5" but if you have a blast shield or a linear compensator, you should be able to use a longer handguard up to 15".
a 15" handguard would cover the muzzle ports. bad news.
I saw a YouTube video where the guy used a 13" rail, and it looked about 1 inch away from the muzzle brake. Keep in mind this was a video, so it the distance was difficult to determine. I know the 13" rail worked, though. I think it was a Faxon rail, if I remember correctly.