I will take the application named "RSSOwl" as an example.
The first thing we have to do is to open this folder:
Here we find a lot of files and some with a name ending with ".desktop". These are textfiles and therefore can be opened via any texteditor (like gedit). But when we do a doubleclick, the appliction representing the file (in this case RSSOwl) will be opened, so we have to open the file by dragging it onto an opened gedit-window (actually, this was the only way I was able to open it, as this file wasn't shown in gedits' file-requester. The problem that came up with this solution was that gedit showed that files' name as "alacarte-made-3.desktop". I can't say why this happened and the edited file got saved with the original filename as well (when I went on editing) a backup-file with that strange filename was saved.
When we open the file named "RSSOwl" with gedit, we see this: (username is replaced with ###):
The interesting parts are the lines starting with "Icon". There are two, the first being language-specific, the other being generic. These lines have to be edited like described below. But for that we first have to find an appropriate icon. And a good place to find one is the path that is found in the line starting with "Exec=". If we look into that folder, we will find a file named "icon.xpm".
To actually use that icon, we have to replace this line:
with this (### should be replaced with your username):
We have to do this with all lines starting with "Icon". To be 100% correct, it would probably be sufficient, if we would only change the line starting with "Icon[en_US]=", if we would only use one language all the time. But if we change all the lines, we can be sure that the same icon is used, regardless which language is activated in Ubuntu.
Anyhow, after saving this file, we should see the appropriate icon for "RSSOwl" within Ubuntus' "Applications/Programming"-submenu