GoG.com DOSBox games start the DOSBox executable with some configs as parameters. You will have to do the same when adding the shortcuts to Steam.
First of all, pick your game. I will pick Ultima Underworld 1 because I have it installed. Right click on the desktop shortcut generated by the installer (if you don't have it on your desktop anymore, check the game's installation folder, there is one there; mine is called "Launch Ultima Underworld 1"), and see its properties:

The shortcut's target is what matters to us. Copy everything in there, and keep it for later. In my case, the full field looked like this:
"F:\GOG Games\Ultima Underworld 1 and 2\DOSBOX\DOSBox.exe" -conf "..\Ultima Underworld 1\dosboxULTIMA1.conf" -conf "..\Ultima Underworld 1\dosboxULTIMA1_single.conf" -noconsole -c exit
Go to Steam, click on Games
in the top menu, then on Add a non-steam game to my library
. Once the game list window appears, click on browse. Find the DOSBox executable that's being used by your game. In my case this was at F:\GOG Games\Ultima Underworld 1 and 2\DOSBOX\DOSBox.exe
. Add that as a game.
Once done, find the game you added in your games list. Right click on it, then click on Properties
. You will see a Target
field in the newly opened window, with the path to your DOSBox.exe and nothing else. Replace everything in that field with the original shortcut's target that you copied before.

After this your game should run normally when launched by Steam.
Ok, what you do is add your games shortcut to steam, then right click on it in your library and click properties. Then right click on your desktop shortcut for the game and copy the "target" and "start in" sections into the respective sections in the steam shortcut