Close up drafty gap between wood beam and concrete wall?
The amber stuff looks like construction adhesive. Particularly Liquid Nails.

If the void is not load bearing and protected from moisture, then you can fill it with just about anything. The foam filler is a good choice since it's easy to use