Whatever `/bin/sh` is pointing to on your system is probably not Bash and not reading your `.bashrc`. The `/bin/sh` [is hardcoded](https://github.com/geany/geany/blob/1.33.0/src/build.c#L728). If you want a comparable test in the builtin VTE terminal, change `Preferences->Terminal->Shell` to `/bin/sh` and that would be equivalent to what's going on in the build command.
You could probably set your build command to `bash -c 'context "%d/%f"'` or else just use the full path to `context` like `/usr/home/martin/context/tex/texmf-freebsd-amd64/bin/context "%d/%f"`. Alternatively, you could figure out what shell is `/bin/sh` and use its mechanism for updating `PATH` as you do with Bash.